#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>

using namespace std;

class OutFunction {
public:
	void operator()(size_t data) {
		cout << data << " ";
	}
};

void printUsingForeach(const vector<size_t>& storage) {
	for_each(storage.begin(), storage.end(), [](size_t data){
		cout << data << " ";
	});

}

void printUsingIterators(const vector<size_t>& storage) {
	vector<size_t>::const_iterator it = storage.begin();
	vector<size_t>::const_iterator endIter = storage.end();
	for(;it != endIter; ++it ) {
		cout << *it << " ";
	}
}

void printUsingFunctor(const vector<size_t>& storage) {
	OutFunction functor;
	for_each(storage.begin(), storage.end(),functor);
}

int main() {

	vector<size_t> storage;
	for( size_t i = 0; i < 10; i++ ) {
		storage.push_back(i * 2 + 1);
	}

	printUsingFunctor(storage);
	//printUsingForeach(storage);

	return EXIT_SUCCESS;
}

